package zigzag.designpattern.mediator;

public class Mediator {
    BtnCalculate btnCal;
    BtnHalt btnHalt;
    BtnStop btnStop;
    LblDisplay show;
    //....
    void registerCalculate(BtnCalculate c) {
    	btnCal = c;
    }
    void registerHalt(BtnHalt h) {
    	btnHalt = h;
    }
    void registerStop(BtnStop s) {
    	btnStop = s;
    }
    void registerDisplay(LblDisplay d) {
        show = d;
    }
    void cal() {
    	btnCal.setEnabled(false);
    	btnHalt.setEnabled(true);
    	btnStop.setEnabled(true);
       show.setText("Calculating...");
    }
    void halt() {
    	btnCal.setEnabled(true);
    	btnHalt.setEnabled(false);
    	btnStop.setEnabled(true);
       show.setText("Halted...");
    }
    void stop() {
    	btnCal.setEnabled(true);
    	btnHalt.setEnabled(true);
    	btnStop.setEnabled(false);
       show.setText("Stopped...");
    }
}

